package org.komarichin.beans.dao;

import org.komarichin.beans.IComment;
import org.komarichin.beans.IGenericEntity;
import org.komarichin.beans.IHasComment;

import java.util.Collection;

/**
 * <p>
 * &nbsp;Dao object for comment
 * </p>
 * User: Michael Komarichin
 * Date: Mar 7, 2010
 * Time: 9:48:06 PM
 */
public interface ICommentDAO<T extends IComment, PK> extends IGenericDAO<T, PK> {
    /**
     * loading comments for object class
     *
     * @param classObj class object for which need loading comment
     * @param idValue  identifier of object
     * @return collection of comments
     */
    Collection<IComment<PK>> getCommentsForObject(Class<? extends IHasComment<IComment<PK>, IGenericEntity>> classObj, Object idValue);

    /**
     * loading comments for object
     *
     * @param obj object for which need loading comment
     * @return collection of comments
     */
    Collection<IComment<PK>> getCommentsForObject(IHasComment<IComment<PK>, IGenericEntity> obj);

    /**
     * assign comment to object or add child for parent object
     *
     * @param obj     parent object
     * @param comment comment
     */
    void assignCommentToObject(IHasComment<IComment<PK>, IGenericEntity> obj, IComment<PK> comment);
}
